import { defineConfig } from 'umi';
import theme from './theme';

if (process.env.NODE_ENV !== 'production') {
  console.log(`.env文件中的Cookie是${process.env.Cookie}`);
}
export default defineConfig({
  favicon: 'data:;base64,=',
  hash: true,
  // dynamicImport: {
  //   loading: '@/components/Loading',
  // },
  targets: {
    ie: 11,
  },
  title: '商飞制造',
  locale: {
    default: 'zh-CN',
    antd: true,
  },
  ignoreMomentLocale: true,
  base: '/tasks-manage-web/',
  publicPath: '/tasks-manage-web/',
  theme,
  proxy: {
    '/tasks-manager-app': {
      // 待办组件
      // target: 'http://mom2dev.comac.int',
      // target: 'http://common.comac.intra',
      target: 'http://localhost:8080',
      changeOrigin: true,
      headers: {
        Cookie: process.env.Cookie,
      },
    },
  },
  chainWebpack(config) {
    // 修改less-loader的css-modules的配置，添加文件名作为前缀
    config.module
      .rule('less')
      .oneOf('css-modules')
      .use('css-loader')
      .options({
        modules: {
          localIdentName: '[name]__[local]__[hash:base64:5]',
        },
      });
  },
});
